package git.soulbgm;

import git.soulbgm.pojo.Student;
import git.soulbgm.utils.JDBCUtil;

import java.util.List;
import java.util.UUID;

/**
 * @author 贺瑞杰
 * @version V1.0
 * @date 2019-04-01 9:50
 * @description
 */
public class Application {

    public static void main(String[] args) throws IllegalAccessException, InstantiationException {
        String sql = "select * from student";
        List<Student> list = JDBCUtil.find(sql, null, Student.class);
        System.out.println(list.size());

        sql = "select * from student where student_no = ?";
        Student stu = JDBCUtil.findOne(sql, new Object[]{"f86461a7-a3f1-4c92-ad7f-5ed58729cc0d"}, Student.class);
        System.out.println(stu);

        stu.setStudentNo(UUID.randomUUID().toString());
        System.out.println(JDBCUtil.insert(stu));

        stu.setPhone(null);
        stu.setAddress("修改的地址");
        System.out.println(JDBCUtil.update(stu, "studentNo"));

    }



}
